$(function(){
   var data = {
		method: "GET",
		url: path+'/proposal',
		columns: [
			{field:'checked',checkbox:true},
			{field:'proposalId',visible:false},
			{field:'proposalAccessId',visible:false},
			{field:'proposalTheme',title:'意见主题'},
			{field:'proposalPeople',title:'发布人'},
			{field:'proposalDetail',title:'描述意见'},
			{field:'proposalDate',title:'日期'},
			{
				field:'proposalReply',
				title: '回复内容',
				formatter: function (value, row, index) {
					if(value == "" || typeof(value) == "undefined" || value == null){
						return '<button disabled class="layui-btn layui-btn-disabled">查看回复</button>';
					}else{
						return '<button data-flag="seeReply'+index+'" onclick="seeReply(this,\''+value+'\')" class="layui-btn layui-btn-normal">查看回复</button>'
					}
				}
			},
			{field:'proposalState',title:'反馈状态'}
		],	
		 sortable: true,
         sortOrder: "asc",
         search: false
   }
   
   var param = [{text:"发布人",name:"proposalPeople",type:"text",verify:"chineseStr"},{text:"日期",name:"dateScope",type:"text",verify:""},{text: "反馈状态",name: "proposalState",type: "select",option:[{key: "等待反馈",value: "等待反馈"},{key: "保留意见",value: "保留意见"},{key: "采纳意见",value: "采纳意见"}]}];
   
   createQueryPanel(param);
   
   renderTable(cTable,data);
   
   //日期范围
   laydate.render({
     elem: '[name="dateScope"]'
     ,range: true
   });
   
   form.render();
})

function seeReply(_this,content){
	//获取触发了当前函数的对象,通过对象获取到data-flag属性值,在通过选择器来定位到指定的dom对象
	layer.tips(content, "[data-flag='"+$(_this).data("flag")+"']");
}

$("#reply_btn").click(function(){//回复也适用于修改
	openOperateWindow({
		title: "回复意见",
		isUpdate: true,
		url:"/admin/systemManagement/proposal/proposal-reply.jsp"
	})
})

$("#remove_btn").click(function(){
	requestRemoveData("proposalId","/proposal");
});